package com.lagou.edu.support;/**
 * Created by IntelliJ IDEA.
 * User: Yangdx.
 * Date: 2020/5/8.
 * Time: 2:25.
 * Tags: Code, we are serious.
 */

import com.lagou.edu.utils.TransactionManager;

import java.lang.reflect.Proxy;

/**
 * @author
 * @create 2020-05-08 2:25
 **/
public class TransactionEnabledAnnotationProxyManager {
    private TransactionManager transactionManager;

    public TransactionEnabledAnnotationProxyManager(TransactionManager transactionManager)
    {

        this.transactionManager = transactionManager;
    }

    public Object proxyFor(Object object)
    {
        return Proxy.newProxyInstance(object.getClass().getClassLoader(), object.getClass().getInterfaces(), new AnnotationTransactionInvocationHandler(object, transactionManager));
    }
}
